*******************************************************************************
******************************  FIGURE A3  ************************************
*************** Study 1 Team-Building Task Measures Over Time******************
*******************************************************************************
clear all
set more off

//cd "C:/Users/ganth/Dropbox/StrengthInNumbersReplicationPackage/replicable/figure_a3"

********************************************************************************

use "figure_a3_dataset.dta", clear
foreach var of varlist genderminfl_lab1_ratio genderminfl_lab2_ratio genderspokes_lab1_ratio genderspokes_lab2_ratio {
reg `var' i.fall_condition
	margins fall_condition, post
	estimates store margins
outreg2 margins using "intermediate_data/`var'", replace dta side noparen noas
}

	*labs
use "intermediate_data/genderminfl_lab1_ratio_dta.dta", clear
	gen time = "Lab 1"
append using "intermediate_data/genderminfl_lab2_ratio_dta.dta"
	replace time = "Lab 2" if time==""
	drop if v1==""
	drop if v1=="VARIABLES"
	drop if v1=="Observations"
	replace v1="1F Group" if v1=="1bn.fall_condition"
	replace v1="3F Group" if v1=="3.fall_condition"
	destring v3 v2, replace
	ren v1 condition
	ren v2 estimate
	ren v3 stderr
	gen ci=stderr*1.96
export delimited "intermediate_data/genderminfl_bylab_forgraphing.csv", replace

	*spokesperson
use "intermediate_data/genderspokes_lab1_ratio_dta.dta", clear
	gen time = "Lab 1"
append using "intermediate_data/genderspokes_lab2_ratio_dta.dta"
	replace time = "Lab 2" if time==""
	drop if v1==""
	drop if v1=="VARIABLES"
	drop if v1=="Observations"
	replace v1="1F Group" if v1=="1bn.fall_condition"
	replace v1="3F Group" if v1=="3.fall_condition"
	destring v3 v2, replace
	ren v1 condition
	ren v2 estimate
	ren v3 stderr
	gen ci=stderr*1.96
export delimited "intermediate_data/genderspokes_bylab_forgraphing.csv", replace
